import { DATA_DIC_INFO } from '@/store/mutation-types'
import { findDataDicInfoByType } from '@/api/dataDicInfo'

const menu = {
  state: {
    modules: []
  },
  mutations: {
    [DATA_DIC_INFO.MODULES]: (state, modules) => {
      state[DATA_DIC_INFO.MODULES] = modules
    }
  },
  actions: {
    [DATA_DIC_INFO.MODULES]: async ({ commit }) => {
      const result = await findDataDicInfoByType(1)
      commit(DATA_DIC_INFO.MODULES, result)
    }
  }
}

export default menu
